<template>
	<view>
		<u-navbar height="44px" :bgColor="bgColor" :title="title" @leftClick="BackPage" @rightClick="rightClick"
			:fixed="true" :placeholder="isPlaceholder" :rightText="rightText" :rightIcon="rightIcon">
			<view class="u-nav-slot" slot="left">
				<u-icon name="arrow-left" size="19" v-if="isShowLeft"></u-icon>
			</view>
		</u-navbar>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		props: {
			//固定在顶部时，是否生成一个等高元素，以防止塌陷
			isPlaceholder: {
				type: Boolean,
				default: true
			},
			//是否显示左边返回按钮
			isShowLeft: {
				type: Boolean,
				default: true
			},
			//标题
			title: {
				type: String,
				default: '',
			},
			//背景颜色
			bgColor: {
				type: String,
				default: '#fff'
			},
			// 右边文本
			rightText: {
				type: String,
				default: ''
			},
			//右边返回图标的名称，只能为uView自带的图标
			rightIcon: {
				type: String,
				default: ''
			},
			
		},
		onLoad() {

		},
		methods: {
			BackPage() {
				// #ifdef H5
				window.history.go(-1)
				// #endif

				// #ifndef H5
				uni.navigateBack({
					delta: 1
				});
				// #endif
			},
			rightClick() {
				this.$emit('rightClick')
			}
		}
	}
</script>

<style lang="scss">
	.u-page__item__slot-icon {
		font-weight: normal;
		width: 48rpx;
		height: 48rpx;
	}
</style>
